Drug diversion, defined as ?the transfer of a controlled substance from a lawful to an unlawful channel of distribution or use,? is a challenging issue in today's healthcare systems. Based on an analysis, the volume of dosage lost due to diversion increased from 21 million in 2017 to 47 million in 2018, a 126% increase. This resulted in over $450M loss to healthcare systems due to drug diversion, a 50% increase compared to 2017. Hospitals and medical centers constitute the single largest category affected by drug diversion accounting for 33% of all cases and 94% of drug diversion incidents involved opioids. Addressing the drug diversion problem is a multi-faceted problem involving many components ranging from provider training to implementation of hardware and software systems to manage access to controlled substances. However, despite recent improvements in controlling and monitoring access to controlled substances, the process of identifying drug diversion is complicated and time consuming. In this Phase I project, we propose to build on our earlier work in machine learning and automated technologies in healthcare and consensus in a distributed and decentralized architecture to develop a technology based on blockchains to track and document transportation and administration of controlled substances in a hospital environment. The proposed system involves using a smartphone app to scan uniquely generated barcodes for vials of controlled substances during the transport process, digitally sign medication transfers between staff using secure digital certificates to eliminate current paper-based systems, and finally document administration of a controlled substance to the patient by scanning the unique barcode assigned to the vial and recording an after administration picture of the empty vial. Specific Aims: 1) Developing and validating an in silico model of drug transport/diversion in the hospital; we will develop a stochastic model of controlled substance vial movement in the hospital between a series of locations at the hospital. The vials are exchanged between these locations by agents that represent clinical staff. 2) Developing a blockchain-based framework to track medications; we will use the Hyperledger Fabric, an open-source blockchain framework geared towards enterprise applications to design and implement a blockchain framework. We will develop a software interface to record data in and retrieve data from the blockchain (and in a potential Phase II, retrieve data from EMRs and automated dispensing cabinets) for further processing. Finally, we will use the in silico model to quantify the computational power and storage requirements for the blockchain framework discussed above; and 3) Development of an algorithm to identify diversion, the goal of this specific aim is to develop a computational engine that uses data (recorded in the blockchain) to detect drug diversion. We propose to use a framework based on machine learning to detect anomalies in data (i.e., drug diversion). !